GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ssh.then   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 54

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 54
rs 9.6716
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 50 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
var path = require('path');
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
var fs = require('fs');
3
var JSZip = require("jszip");
4
var rsync = require("rsyncwrapper");
5
var chalk = require('chalk');
6
var emoji = require('node-emoji');
7
var node_ssh = require('node-ssh');
8
var ssh = new node_ssh();
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like node_ssh should be capitalized.
Loading history...
9
10
var enviroment = process.env.npm_package_config_enviroment;
11
var server_name = process.env.npm_package_config_server;
12
var server_ip = process.env.npm_package_config_ip;
13
14
process.stdout.write(chalk.gray(emoji.emojify("[  ] Deploy externalLogin on ("+ enviroment +").\n")));
15
16
ssh.connect({
17
  host: server_name,
18
  username: 'developer',
19
  privateKey: './server/plays/ssh/developer.key',
20
  port: 2222
21
}).then(function() {
22
  var nextCommand = ssh.mkdir('/var/www/auth.local/src/');
23
  // @see: https://github.com/steelbrain/node-ssh/blob/master/src/index.js
24
  nextCommand.then( function(){
25
    ssh.exec('rm', ['-rf', 'public'], { cwd: '/var/www/auth.local', stream: 'both' }).then( function(both){
0 ignored issues
show
Unused Code introduced by
The parameter both is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
26
      ssh.exec('ln', ['-s','web','public'], { cwd: '/var/www/auth.local', stream: 'both' }).then( function(both){
0 ignored issues
show
Unused Code introduced by
The parameter both is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
27
          ssh.dispose();
28
          process.stdout.write(chalk.gray(emoji.emojify("Prepare dir remote completed.\n")));
29
30
          process.stdout.write(chalk.gray(emoji.emojify("Start rsync src.\n")));
31
32
          rsync({
33
              src: "./applications/externalLogin/",
34
              dest: 'developer@' + server_name + ':/var/www/auth.local/',
35
              ssh: true,
36
              privateKey: './server/plays/ssh/developer.key',
37
              port: 2222,
38
              exclude: [ 'test', '.DS_Store', 'phpunit.xml', 'README.md', 'vendor' ],
39
              recursive: true,
40
              deleteAll: false //senno elimina log!
41
          },function (error,stdout,stderr,cmd) {
42
              if ( error ) {
43
                  process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] "+'CMD: '+cmd+"\n")));
44
                  process.stderr.write(chalk.red(error.message+"\n"));
45
                  process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
46
              }
47
          });
48
49
          process.stdout.write(chalk.gray(emoji.emojify("Avvio composer install\n")));
50
51
          ssh.connect({
52
            host: server_name,
53
            username: 'developer',
54
            privateKey: './server/plays/ssh/developer.key',
55
            port: 2222
56
          }).then(function() {
57
            ssh.exec('composer', ['install', '--no-dev', '--optimize-autoloader', '--no-interaction', '--no-progress', '--no-scripts'], { cwd: '/var/www/auth.local/', stream: 'both' }).then(function(both) {
58
              process.stdout.write(chalk.gray(emoji.emojify(both.stdout+"\n")));
59
              if ( both.code === 0 ){
60
                process.stdout.write(chalk.gray(emoji.emojify(both.stderr+"\n")));
61
              } else {
62
                process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore composer\n")));
63
                process.stderr.write(chalk.red(both.stderr+"\n"));
64
                process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
65
              }
66
              process.stdout.write(chalk.bgGreen.black(emoji.emojify('[:heavy_check_mark: ] Deploy COMPLETED.' + "\n")));
67
              ssh.dispose();
68
            });
69
          });
70
71
      });
72
    });
73
  });
74
});
75